package aps

import glory.xxd.Utils
import org.json.JSONObject

/**
 * 更换刀片前采集一次刀片暴露量
 */
class BeforeChangeHubBladeController {

    def commentService

    /**
     *
     <Request>
     <Header>
     <TRANSACTIONID>9c36ccc4-b164-4fd4-8621-6fb1f9c59c1b</TRANSACTIONID>
     <MESSAGENAME>BeforeChangeHubBlade</MESSAGENAME>
     <USERNAME>PDA</USERNAME>
     </Header>
     <Body class="Body">
     <USERNAME>G2976</USERNAME>
     <EQPID>1FS05</EQPID>
     </Body>
     </Request>
     */
    def index() {

        def EQPID = params.EQPID ?: ""
        def USERNAME = params.USERNAME ?: ""

        def body =JSONObject.newInstance()
        body.put("EQPID",EQPID)
        body.put("USERNAME",USERNAME)

        String logUUID = Utils.getUUID();
        def header = JSONObject.newInstance()
        header.put("MESSAGENAME","BeforeChangeHubBlade")
        header.put("TRANSACTIONID",logUUID)
        header.put("USERNAME",'PDA')

        def jsonAll = [Header:header,Body:body] //JSONObject.newInstance()

        def jsonRequest = JSONObject.newInstance()
        jsonRequest.put("Request",jsonAll)

        def json = commentService.getJsonByJsonForTopic2Queue(logUUID, jsonRequest)

        render json
    }
}
